package com.xm9m.web.service.security.oauth2;

import com.salesmanager.web.utils.ServletUtils;
import com.xm9m.web.service.constants.StatusCode;
import com.xm9m.web.service.internal.util.BuildResponseUtil;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.oauth2.provider.error.AbstractOAuth2SecurityExceptionHandler;
import org.springframework.security.web.access.AccessDeniedHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by 123 on 2015/12/8.
 */
public class DefaultOAuth2AccessDeniedHandler extends AbstractOAuth2SecurityExceptionHandler implements AccessDeniedHandler {

    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException authException)
            throws IOException, ServletException {
        ServletUtils.responseOutWithJson(response, BuildResponseUtil.buildSimpleResponse(StatusCode.LOGIN_ERROR));
      //  doHandle(request, response, authException);
    }
}
